---
layout: "default"
title: "first"
description: "Swift documentation for 'first': Returns the first element of x, or nil if x is empty."
keywords: "first,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-first-c_-collectiontype_-c">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-first-c_-collectiontype_-c">func <wbr>first&lt;C : CollectionType&gt;(<wbr>_: C)</a>
        
<div class="comment collapse" id="comment-func-first-c_-collectiontype_-c"><div class="p">
    <p>Returns the first element of <code>x</code>, or <code>nil</code> if <code>x</code> is empty.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func first&lt;C : CollectionType&gt;(x: C) -&gt; C.Generator.Element?</code>
    
    
</div></div>
</div>
